import Vue from 'vue'
import Router from 'vue-router'
const Index = resolve => require(['/page/index'], resolve)
const Test = resolve => require(['/page/test'], resolve)
const Login = resolve => require(['/page/Login/login'], resolve)
const Home = resolve => require(['/page/Home/home'], resolve)
const GoodS = resolve => require(['/page/Goods/goods'], resolve)
const goodsDetails = resolve => require(['/page/Goods/goodsDetails'], resolve)
const Cart = resolve => require(['/page/Cart/cart'], resolve)
const order = resolve => require(['/page/Order/order'], resolve)
const user = resolve => require(['/page/User/user'], resolve)
const orderList = resolve => require(['/page/User/children/order'], resolve)
const orderDetail = resolve => require(['/page/User/children/orderDetail'], resolve)
const orderRate = resolve => require(['/page/User/children/orderRate'], resolve)
const information = resolve => require(['/page/User/children/information'], resolve)
const aboutUs = resolve => require(['/page/User/children/aboutUs'], resolve)
const addressList = resolve => require(['/page/User/children/addressList'], resolve)
const coupon = resolve => require(['/page/User/children/coupon'], resolve)
const aihuishou = resolve => require(['/page/User/children/aihuishou'], resolve)
const support = resolve => require(['/page/User/children/support'], resolve)
const checkout = resolve => require(['/page/Checkout/checkout'], resolve)
const payment = resolve => require(['/page/Order/payment'], resolve)
const paysuccess = resolve => require(['/page/Order/paysuccess'], resolve)
const Wechat = resolve => require(['/page/Order/wechat'], resolve)
Vue.use(Router)
export default new Router({
//	mode: 'history',
//		base: '/pc/',
	routes: [{
			path: '/',
			component: Index,
			name: 'index',
			redirect: '/home',
			children: [{
					path: 'home',
					component: Home
				},
				{
					path: 'goods',
					name: 'goods',
					component: GoodS
				},
				{
					path: 'goodsDetails',
					name: 'goodsDetails',
					component: goodsDetails
				}
			]
		},
		{
			path: '/login',
			name: 'login',
			component: Login
		},
		{
			path: '/cart',
			name: 'cart',
			component: Cart
		},
		{
			path: '/order',
			name: 'order',
			component: order,
			children: [{
					path: 'paysuccess',
					name: 'paysuccess',
					component: paysuccess
				},
				{
					path: 'payment',
					name: 'payment',
					component: payment
				},
				{
					path: 'wechat',
					name: 'wechat',
					component: Wechat
				},
			]
		},
		{
			path: '/user',
			name: 'user',
			component: user,
			redirect: '/user/orderList',
			children: [{
					path: 'orderList',
					name: '订单列表',
					component: orderList
				},
				{
					path: 'orderDetail',
					name: '订单详情',
					component: orderDetail
				},
				{
					path: 'orderRate',
					name: '订单详情',
					component: orderRate
				},
				{
					path: 'information',
					name: '账户资料',
					component: information
				},
				{
					path: 'aboutUs',
					name: '关于我们',
					component: aboutUs
				},
				{
					path: 'addressList',
					name: '收货地址',
					component: addressList
				},
				{
					path: 'coupon',
					name: '我的优惠',
					component: coupon
				},
				{
					path: 'support',
					name: '售后服务',
					component: support
				},
				
			]
		},
		{
			path: '/checkout',
			name: 'checkout',
			component: checkout
		},
		//  {path: '*', redirect: '/home'}
		//  {path: '/test', component: Test}
	]
})